<template>
  <div class="member-order-detail" v-if="order">
    <!-- 头部 -->
     <DetailAction :order="order" />
     <!-- 进度 -->
<DetailSteps :order="order"/>
<!-- 物流信息 -->
<Suspense>
  <template #default><DetailLogistics v-if="[3,4,5].includes(order.orderState)" :order="order" /></template>
    <template #fallback>loading...</template>
</Suspense>
<!-- 商品信息组件 -->
<OrderInfo :order="order" />
  </div>
</template>

<script>
import { ref } from 'vue'
import { findOrder } from '@/api/order'
import DetailAction from './components/detail-action'
import { useRoute } from 'vue-router'
import DetailSteps from './components/detail-steps.vue'
import DetailLogistics from './components/detail-logistics.vue'
import OrderInfo from './components/detail-info.vue'
export default {
  name: 'MemberDetail',
  components: {
    DetailAction, DetailSteps, DetailLogistics, OrderInfo
  },
  setup () {
    const order = ref(null)
    const route = useRoute()

    findOrder(route.params.id).then(data => {
      order.value = data.result
    })
    return { order }
  }
}
</script>

<style lang="less" scoped>

.ember-order-detail{
background-color: #fff;
height: 100%;
}
</style>
